import request from '@/utils/request';
/**
 * 创建广告协商
 * @param {Object} data - 协商数据
 * @param {Number} data.adId - 广告ID
 * @param {Number} data.price - 协商价格
 * @param {Array} data.timeSlots - 播放时段列表
 * @param {String} data.content - 协商内容
 * @returns {Promise} Promise对象
 */
export function createNegotiation(data) {
    return request({
        url: '/negotiation',
        method: 'post',
        data
    });
}
// 获取协商列表
// 获取协商列表
export function getNegotiationList(params) {
    return request({
        url: '/negotiation/list',
        method: 'get',
        params: {
            pageNum: params.pageNum,
            pageSize: params.pageSize,
            adname: params.adname,
            deviceId: params.deviceId,
            status: params.status
        }
    });
}

// 获取协商详情
export function getNegotiationDetail(id) {
    return request({
        url: `/negotiation/${id}`,
        method: 'get'
    });
}

// 完成协商
export function completeNegotiation(id) {
    return request({
        url: `/negotiation/${id}/complete`,
        method: 'put'
    });
}

// 取消协商
export function cancelNegotiation(id) {
    return request({
        url: `/negotiation/${id}/cancel`,
        method: 'put'
    });
}

// 更新协商
export function updateNegotiation(id, data) {
    return request({
        url: `/negotiation/${id}`,
        method: 'put',
        data
    });
}